//所有接口返回的数据类型
export interface ResponseData {
  code: number
  message: string
  ok: boolean
}

//spu接口返回的数据类型
export interface SpuData {
  id?: number
  spuName: string
  description: string
  category3Id: string | number
  tmId: number | string
  spuSaleAttrList: null | SaleAttr[]
  spuImageList: null | SpuImg[]
}
//定义一个数组类型，元素都是已有spu数据类型
export type Records = SpuData[]

//定义此接口方法返回的数据类型
export interface HasSpuResponseData extends ResponseData {
  data: {
    records: Records
    total: number
    size: number
    current: number
    searchCount: boolean
    pages: number
  }
}

//所有品牌数据的ts类型
export interface TradeMark {
  id: number
  tmName: string
  logUrl: string
}
//品牌接口返回的数据类型
export interface AllTradeMark extends ResponseData {
  data: TradeMark[]
}

//商品图片的类型
export interface SpuImg {
  id?: number
  upadateTime?: string
  createTime?: string
  spuId?: number
  imgName: string
  imgUrl: string
  name?: string
  url?: string
}
//获取spu图片接口方法返回的数据类型
export interface SpuHasImg extends ResponseData {
  data: SpuImg[]
}

//已有的销售属性值类型
export interface SaleAttrValue {
  id?: number
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrValueName: string
  saleAttrName?: string
  isChecked?: null
}
//销售属性值数组的类型
export type spuSaleAttrValueList = SaleAttrValue[]

//销售属性对象的类型
export interface SaleAttr {
  id?: number
  createTime?: null
  updateTime?: null
  spuId?: number
  baseSaleAttrId: number | string
  saleAttrName: string
  spuSaleAttrValueList: spuSaleAttrValueList
  flag?: boolean
  saleAttrValue?: string
}
//spu已有销售属性接口返回的数据类型
export interface SaleAttrResponseData extends ResponseData {
  data: SaleAttr[]
}

//全部销售属性的类型
export interface HasSaleAttr {
  id: number
  name: string
}
export interface HasSaleAttrResponseData extends ResponseData {
  data: HasSaleAttr[]
}
//sku数据类型
export interface SkuData {
  id?: number
  category3Id: string | number
  spuId: string | number
  tmId: string | number
  skuName: string
  price: string | number
  weight: string | number
  skuDesc: string //sku描述
  skuAttrValueList?: Attr[] //平台属性收集
  skuSaleAttrValueList?: saleAttr[] //销售属性
  skuDefaultImg?: string //sku图片地址
  isSale?: number //上架与下架状态
}

export interface Attr {
  attrId: number | string //平台属性id
  valueId: number | string //属性值id
}
export interface saleAttr {
  saleAttrId: number | string
  saleAttrValueId: number | string
}

//获取sku接口的数据类型
export interface SkuInfoData extends ResponseData {
  data: SkuData[]
}
